<?
/*
*   wanchalerm boonyakanjana
*/
    include "../config/config.inc.php";
    include "../class/db.inc.php";
    $db = new Db();
    $db->db_connect($config);
    // echo "ko=>".$id;
    //$db->set_company($id) ;
    $db->cp_id=$id;
    $comp_profile = $db->get_company( );
    $comp_contact =  $db->get_contact( );
    $comp_addr =  $db->get_compay_address( );    
   // print_r($comp_profile)
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="../css/style.css" rel="stylesheet" type="text/css" />


<script type="text/javascript">
 
function codename() {
alert('aaaaaaaaa');
if(document.formname.checkboxname.checked)
{
    document.form1.member_of[].disabled=false;
}

else
{

    document.form1.member_of[].disabled=falsetrue;
}
}
 
</script>

</head>

<body>
<form id="form1" name="form1" method="post" enctype="multipart/form-data"  action="insdb.php">
<center>
<table width="80%" border="0" cellpadding="1" cellspacing="1">
  <tr>
    <td bgcolor="#CACACA"><table width="100%" border="0" cellpadding="1" cellspacing="1">
      <tr>
        <td bgcolor="#FCFCFC" align="left"><table><tr><td><img src="../image/mi.jpg" border=0 longdesc="" /></td><td><h1>East West Economic Corridor (EWEC) Business Database</h1></td></tr></table></td>
      </tr>
      <tr>
        <td align="right" bgcolor="#FCFCFC" class="bodyText"><a href="addform.php">Add Company</a> | <a href="list.php">List Company</a> | <a href="export.php">Export Data</a> </td>
      </tr>
      <tr>
        <td align="right" bgcolor="#FCFCFC"><span class="bodyText">Select Language</span> 
            <label>
              <select name="language">
                <option value="en">English</option>
                <option value="th">Thai</option>
                <option value="lo">Loas</option>
                <option value="bm">Burmese</option>
                <option value="vn">Vietnamese</option>
              </select>
              </label>          </td>
      </tr>
    </table>
	
	  <table width="100%" border="0" cellpadding="3" cellspacing="2" bgcolor="#CCCCCC" class="table">
      <tr>
        <td width="5%" valign="top">&nbsp; </td>
        <td width="32%" align="right" valign="top">1.Name of Company <span class="text_require">* </span></td>
        <td width="63%" align="left" valign="top"><label>
          <input name="cp_name" type="text" size="50" maxlength="100"  value="<? echo $comp_profile["cp_name"];?>" />
        </label></td>
        </tr>
      <tr>
        <td valign="top">&nbsp; </td>
        <td align="right" valign="top"><p>2.Brief Description of the Company <span class="text_require">* </span></p>
          </td>
        <td valign="top" align=left><p>
          <textarea name="cp_description" cols="50" rows="5"><? echo $comp_profile["cp_desc"];?></textarea><br />
          <span class="text_description">(Please provide brief information about the uniqueness of your company, products or services. Text limit is 150 words and subjected to be edited.) </span></p>
          </td>
        </tr>
       <tr>
        <td valign="top">&nbsp; </td>
        <td align="right" valign="top"> 3.Brand Name (or trademark) </td>
        <td valign="top" align=left><input name="cp_brand" type="text" size="50" maxlength="100"  value="<? echo $comp_profile["cp_brand"];?>"/></td>
        </tr>
       <tr>
        <td valign="top">&nbsp; </td>
        <td align="right" valign="top"> 4.Your company's logo </td>
        <td valign="top" align=left> <p>
          <input type="file" name="cp_logo" />
          <br />
          </p>
          </td>
       </tr>
       <tr>
        <td valign="top">&nbsp; </td>
        <td align="right" valign="top"> 5.Contact Detail <span class="text_require">* </span> </td>
        <td valign="top">&nbsp;</td>
       </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top"> Name </td>
        <td valign="top" align=left><input name="cp_contact_name" type="text" size="50" maxlength="100" value="<? echo  $comp_contact ["cpc_name"];?>" /></td>
        </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top"> Position </td>
        <td valign="top" align=left><input name="cp_contact_position" type="text" size="50" maxlength="100" value="<? echo  $comp_contact ["cpc_position"];?>"/></td>
        </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top"> Phone </td>
        <td valign="top" align=left><input name="cp_contact_phone" type="text" size="20" maxlength="100" value="<? echo  $comp_contact ["cpc_phone"];?>"/></td>
        </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top"> Fax </td>
        <td valign="top" align=left><input name="cp_contact_fax" type="text" size="20" maxlength="100" value="<? echo  $comp_contact ["cpc_fax"];?>" /></td>
        </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top"> Email </td>
        <td valign="top" align=left><input name="cp_contact_email" type="text" size="50" maxlength="100" value="<? echo  $comp_contact ["cpc_email"];?>"/></td>
        </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top"> MSN/Gtalk/Skype/Yahoo Messanger </td>
        <td valign="top" align=left><input name="cp_contact_msn" type="text" size="50" maxlength="100" value="<? echo  $comp_contact ["cpc_msn"];?>"/></td>
        </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top"> Mailling Address(No.,Street,City) </td>
        <td valign="top" align=left><input name="cp_contact_address" type="text" size="50" maxlength="100" value="<? echo  $comp_contact ["cpc_mailling"];?>" /></td>
        </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top">Province /Country</td>
        <td valign="top" align=left><label>
                  <select name="cp_pc">
            <option value=0 selected> -- </option> 
            <option value=1>Tak / Thailand</option> 
            <option value=2>Kalasin / Thailand</option>              
            <option value=3>Khonkaen / Thailand</option>       
            <option value=4>Mukdahan / Thailand</option>        
            <option value=5>Phitsanulok / Thailand</option> 
            <option value=6>Mon State / Myanmar</option>             
            <option value=7>Kayin State / Myanmar</option>
            <option value=8>Savannakhet / Laos</option>  
            <option value=9>Hue / Vietnam</option>              
            <option value=10 >Quang tri / Vietnam</option>     
            <option value=11>Danang / Vietnam</option>            
          </select>
        </label></td>
       </tr>
 																						
         <tr>
        <td width="5%" valign="top">&nbsp; </td>
        <td width="32%" align="right" valign="top"> 6.Business Address <br>(If different from above address) </td>
        <td width="62%" colspan="2" valign="top">&nbsp;</td>
       </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top"> No. and Street </td>
        <td colspan="2" valign="top" align=left><input name="cp_address" type="text" size="50" maxlength="100" /></td>
        </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top"> Town/City </td>
        <td colspan="2" valign="top" align=left><input name="cp_town" type="text" size="50" maxlength="100" /></td>
        </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top">Province / Country</td>
        <td colspan="2" valign="top" align=left>
                  <select name="cp_contact_pc">
            <option value=0 selected> -- </option> 
            <option value=1>Tak / Thailand</option> 
            <option value=2>Kalasin / Thailand</option>              
            <option value=3>Khonkaen / Thailand</option>       
            <option value=4>Mukdahan / Thailand</option>        
            <option value=5>Phitsanulok / Thailand</option> 
            
            <option value=6>Mon State / Myanmar</option>
            <option value=7>Kayin State / Myanmar</option>
            <option value=8>Savannakhet / Laos</option>
	<option value=10>Hue / Vietnam</option>              
            <option value=11 >Ouantzi / Vietnam</option>     
            <option value=12>Danang / Vietnam</option>            
          </select>
          </td>
       </tr>			
        
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top"> Post Code </td>
        <td colspan="2" valign="top" align=left><input name="cp_postcode" type="text" size="5" maxlength="100" value="<? echo  $comp_addr["cpa_postcode"];?>" /></td>
        </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top">Phone </td>
        <td colspan="2" valign="top" align=left><input name="cp_phone" type="text" size="20" maxlength="100" value="<? echo  $comp_addr["cpa_phone"];?>"/></td>
        </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top"> Fax </td>
        <td colspan="2" valign="top" align=left><input name="cp_fax" type="text" size="20" maxlength="100" value="<? echo  $comp_addr["cpa_fax"];?>" /></td>
        </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top"> Email </td>
        <td colspan="2" valign="top" align=left><input name="cp_email" type="text" size="50" maxlength="100" value="<? echo  $comp_addr["cpa_email"];?>" /></td>
        </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top">Website</td>
        <td colspan="2" valign="top" align=left> 
          <input name="cp_website" type="text" size="50" maxlength="100" value="<? echo  $comp_addr["cpa_website"];?>" />
        </td>
       </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top">7. Year of Establishment <span class="text_require">* </span></td>
        <td colspan="2" valign="top" align=left> 
          <select name="cp_establishment">
          <?
           $s_est= $comp_addr["cp_establishment"];
                for($i =2011;$i>=1950;$i--){
                        if($s_est == $i){
                               $select = "selected";
                            }else{ 
                            $select = " ";
                            }
                        echo "<option value='$i'>$i</option>";
                }
          ?>
        </select>
         </td>
       </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top">8.Number of Employee <span class="text_require">* </span></td>
        <td colspan="2" valign="top" align=left> 
          <input name="cp_employee" type="text" size="5" maxlength="5" value="<? echo $comp_profile["cp_employee"];?>" /> <span class="text_description">(**Number)</span>
        </td>
       </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top">9.Your Company's Registeration </td>
        <td colspan="2" valign="top"><label></label></td>
       </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top">Registered with </td>
        <td colspan="2" valign="top" align=left><label>
          <input name="cp_register_with" type="text" size="50" maxlength="100" value="<? echo $comp_profile["cp_register_with"];?>" />
        </label></td>
       </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top">Year of Registration </td>
        <td colspan="2" valign="top" align=left><label>
        <select name="cp_year_register">
          <?
                      echo "<option value='2011' selected='selected'>2011</option>";
                      $s_est= $comp_addr["cp_year_register"];
                for($i =2011;$i>=1950;$i--){
                        if($s_est == $i){
                               $select = "selected";
                            }else{ 
                            $select = " ";
                            }                    
                        echo "<option value='$i'>$i</option>";
                }
          ?>        
        </select>
        </label></td>
       </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top">Registeration No. </td>
        <td colspan="2" valign="top" align=left><label>
          <input name="cp_register_no" type="text" size="50" maxlength="100" />
        </label></td>
       </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top">10.Type of Busness<span class="text_require">* </span><br /></td>
        <td colspan="2" valign="top" align=left><label><span class="text_description">(you may tick more than one answer) </span></label></td>
       </tr>
        <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top"> <span class="text_description"></span></td>
        <td colspan="2" valign="top" align=left><table width="100%" border="0" cellpadding="1">
        
        <?
        
        
            $result= $db->get_all_business();
                            while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
                                 if($db->get_bc($row["b_id"],$db->cp_id) ==1){
                                           $check="checked";
                                     }
                                     else{
                                         $check="";
                                         }
                                
                                echo " <tr>
                                            <td width=\"100%\" align=\"left\" valign=\"top\"><label>
                                              <input type=\"checkbox\" name=\"product[]\" value=\"".$row["b_id"]."\" $check />
                                             ".$row["b_name"]."</label></td>
                                          </tr>";
                }
        
        ?>
           	    <tr>
            <td width="100%" align="left" valign="top"><label>
 
              </label></td>
          </tr>
          <tr>
            <td colspan="2" align="left" valign="top" align=left><br />other (please specify)<br />
              <textarea name="product_specify" cols="50" rows="5"></textarea></td>
            </tr>			  
        </table>        
        <label></label></td>
       </tr>  
 <tr>
        <td valign="top">&nbsp;</td>
        <?    
        
                $result = $db->get_mp($db->cp_id)  ;
             $row = mysql_fetch_array($result, MYSQL_ASSOC);
            $p1=$row["product_name"];
             $row = mysql_fetch_array($result, MYSQL_ASSOC);
            $p2=$row["product_name"];
             $row = mysql_fetch_array($result, MYSQL_ASSOC);
            $p3=$row["product_name"];
             $row = mysql_fetch_array($result, MYSQL_ASSOC);
            $p4=$row["product_name"];
             $row = mysql_fetch_array($result, MYSQL_ASSOC);
            $p5=$row["product_name"];            
       
        ?>
        <td align="right" valign="top">11.Main Products or services offered <span class="text_require">* </span></td>
        <td colspan="2"  align=left> A.
             <input name="cp_product[]"  type="text"  size="20"  maxlength="50"  value="<? echo $p1; ?>" >  Attach File : 
            <input type=file name=cp_img1>
            <br />
        B. 
          <input name="cp_product[]"  type="text"  size="20"  maxlength="50"  value="<? echo $p2; ?>">   Attach File : 
         <input type=file name=cp_img2>
        <br />
        C. <input name="cp_product[]"  type="text"  size="20"  maxlength="50"  value="<? echo $p3; ?>"> Attach File : 
 <input type=file name=cp_img3>
         
        <br />
        D. <input name="cp_product[]"  type="text"  size="20"  maxlength="50"  value="<? echo $p4; ?>"> Attach File : 
         <input type=file name=cp_img4>
         
        <br />
        E. <input name="cp_product[]"  type="text"  size="20"  maxlength="50"  value="<? echo $p5; ?>"> Attach File : 
      <input type=file name=cp_img[]>
        
        <br />
        F. <input name="cp_product[]"  type="text"  size="20"  maxlength="50"  > Attach File : 
      <input type=file name=cp_img5>
       
 </td>
       </tr>	
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top">12.Corporate Status </td>
        <td colspan="2" valign="top" align=left><table width="100%" border="0" cellpadding="1">
          <tr>
            <td width="50%"><label>
              <input name="corporate[]" type="checkbox" value="1"  <? echo $db->get_cp_status($db->cp_id,1); ?> />
            Sole proprietorship </label></td>
            <td width="50%" align=left><input name="corporate[]" type="checkbox" value="2" <? echo $db->get_cp_status($db->cp_id,2); ?>/> 
              Cooperative </td>
          </tr>
          <tr>
            <td><input name="corporate[]" type="checkbox" value="3" <? echo $db->get_cp_status($db->cp_id,3); ?>/> 
              Limited liability Company </td>
            <td><input name="corporate[]" type="checkbox" value="4" <? echo $db->get_cp_status($db->cp_id,4); ?>/>
Partnership </td>
          </tr>
          <tr>
            <td><input name="corporate[]" type="checkbox" value="5" <? echo $db->get_cp_status($db->cp_id,5); ?>/> 
              Coperatation </td>
            <td>&nbsp;</td>
          </tr>
   <tr>
            <td><br>other<br><textarea name="cp_corporate_other" cols="50" rows="5"><? echo $comp_profile["cp_corporate_other"];?></textarea></td>
          
          </tr>
        </table>		  </td>
       </tr>	
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top">13.Target Market </td>
        <td width="14%" valign="top" align=left><label>
          <input type="checkbox" name="domesic" value="d" />
        Domestic</label> 
        
        <input type="checkbox" name="international" value="i" /> International
         <br>
        Please specify destinations of market<br>
         <textarea name="market" cols="50" rows="5"></textarea>
         </td>
        </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top">14.Annual Production in average <br>(specify in volume) </td>
        <td colspan="2" valign="top" align=left><label>
          <input name="cp_avg" type="text" size="20" maxlength="100" value="<? echo $comp_profile["cp_ap_avg"];?>"/><span class="text_description">(**Number)</span>
        </label></td>
       </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top">15. Annual Production Capacity <br>(specify in volume) </td>
        <td colspan="2" valign="top" align=left><label>
          <input name="cp_capacity" type="text" size="20" maxlength="100" value="<? echo $comp_profile["cp_ap_cop"];?>" /><span class="text_description">(**Number)</span>
        </label></td>
       </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top">16. If any, your company's slogan </td>
        <td colspan="2" valign="top" align=left><label>
          <input name="cp_slogan" type="text" size="50" maxlength="100"  value="<? echo $comp_profile["cp_slogan"];?>"/>
        </label></td>
       </tr>
       <tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top">17. Membership<br />
          (your company is a member of ....)<br />
          (associations,organzations,etc) </td>
        <td colspan="2" valign="top" align=left><label></label>
  
          <input name="member" type="radio" value="0" checked   /> 
          Non Member 
          <input name="member" type="radio" value="1"    /> 
          Member<br />
        
          <hr>
        <b>Thailand </b><br>
       
        <input type="checkbox" name="member_of[]"  value="t1"  <? echo $db->get_mb($db->cp_id,"t1"); ?>   /> CCI (Mukdahan)
        <br>
        <input type="checkbox" name="member_of[]" value="t2"  <? echo $db->get_mb($db->cp_id,"t1"); ?> /> CCI (Kalasin)
         <br>
        <input type="checkbox" name="member_of[]" value="t3"  <? echo $db->get_mb($db->cp_id,"t1"); ?>/> CCI (Khonkaen)
         <br>
        <input type="checkbox" name="member_of[]" value="t4" <? echo $db->get_mb($db->cp_id,"t1"); ?> /> CCI (Phitsanulok)
         <br>
        <input type="checkbox" name="member_of[]" value="t2"  <? echo $db->get_mb($db->cp_id,"t2"); ?>  /> CCI (Tak)
         <br>
        <input type="checkbox" name="member_of[]" value="t3"  <? echo $db->get_mb($db->cp_id,"t3"); ?> /> FTI (Mukdahan)
         <br>
        <input type="checkbox" name="member_of[]" value="t4" <? echo $db->get_mb($db->cp_id,"t4"); ?>  /> FTI (Kalasin)
         <br>
        <input type="checkbox" name="member_of[]" value="t5" <? echo $db->get_mb($db->cp_id,"t5"); ?> /> FTI (Khonkaen)
         <br>
        <input type="checkbox" name="member_of[]" value="t6" <? echo $db->get_mb($db->cp_id,"t6"); ?> /> FTI (Phitsanulok)
         <br>
        <input type="checkbox" name="member_of[]" value="t7"  <? echo $db->get_mb($db->cp_id,"t7"); ?> /> FTI (Tak)
         <br>
        <input type="checkbox" name="member_of[]" value="t8"  <? echo $db->get_mb($db->cp_id,"t8"); ?> /> FTI (Mukdahan)
 
         <hr><b>Vietnam</b><br>
        <input type="checkbox" name="member_of[]" value="v1"   <? echo $db->get_mb($db->cp_id,"v1"); ?>/> CCI (Da Nang)
         <br>
        <input type="checkbox" name="member_of[]" value="v2"  <? echo $db->get_mb($db->cp_id,"v2"); ?> /> Young Enterpreneurs Association (Hue)
         <br>   
        <input type="checkbox" name="member_of[]" value="v3" <? echo $db->get_mb($db->cp_id,"v3"); ?> /> Young Enterpreneurs Association (Da Nang)
         <br>           
        <input type="checkbox" name="member_of[]" value="v4"  <? echo $db->get_mb($db->cp_id,"v4"); ?> /> Cooperative Alliance (Quang Tri)

        <hr><b>Myanmar</b><br>
        <input type="checkbox" name="member_of[]" value="m1"  <? echo $db->get_mb($db->cp_id,"m1"); ?> /> CCI (Kayin State)
         <br>
        <input type="checkbox" name="member_of[]" value="m2" <? echo $db->get_mb($db->cp_id,"m2"); ?> /> CCI (Mon state)
       <hr><b>Loas</b><br>
        <input type="checkbox" name="member_of[]" value="l3"   <? echo $db->get_mb($db->cp_id,"m3"); ?>/> CCI (Savannaket)
 
         <hr>         
          <b>other</b><br>
                     <textarea name="member_other" cols="50" rows="5"><? echo $comp_profile["cp_membership_other"];?></textarea></td>
</td>
       </tr>	
<tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top">18. Awards </td>
        <td colspan="2" valign="top" align=left><label>
          <textarea name="cp_awords" cols="50" rows="3"><? echo $comp_profile["cp_award"];?></textarea>
          <br /><br />
         Attach File :  <input type="file" name="cp_aword_image" />
        </label></td>
       </tr>	   	
<tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top">19. Certifications</td>
        <td colspan="2" valign="top" align=left><label>
          <textarea name="cp_certifications" cols="50" rows="3"><? echo $comp_profile["cp_certificate"];?></textarea>
          <br /><br />
         Attach File :  <input type="file" name="cp_certifications_image" />
        </label></td>
       </tr>	   	
<tr>
<tr>
        <td valign="top">&nbsp;</td>
        <td align="right" valign="top"><b>Note for staff *** </b></td>
        <td colspan="2" valign="top" align=left><label>
          <textarea name="note" cols="50" rows="3"><? echo $comp_profile["note"];?></textarea>
 
         
        </label></td>
       </tr>	   	
<tr>
        <td colspan="4" align="center" valign="top"><label></label>
          </td>
        </tr>	   	   	      	   	   	   	                 	   	   	   	   	   	   	   	   																					
    </table>
	
	</td>
  </tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
</center>
          </form>
</body>
</html>
